---
title: "Install kubectl"
date: 2019-7-9
categories:
- devops
- kubectl
tags:
---

<div id="content">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org7382f6e">2019-7-9</a>
<ul>
<li><a href="#org5c3fd96">Install kubectl binary with curl on Linux</a></li>
<li><a href="#org19ac5e9">Install using native package management</a>
<ul>
<li><a href="#orgfdbebcf">Ubuntu/Debain</a></li>
<li><a href="#orgb1bc823">CentOS, RHEL, Fedora</a></li>
<li><a href="#orgd05c30d">Install with snap</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-org7382f6e">
<h2 id="org7382f6e">2019-7-9</h2>
<div class="outline-text-2" id="text-org7382f6e">
</div>
<div class="outline-3" id="outline-container-org5c3fd96">
<h3 id="org5c3fd96">Install kubectl binary with curl on Linux</h3>
<div class="outline-text-3" id="text-org5c3fd96">
<div class="org-src-container">
<pre class="src src-sh">curl -LO https://storage.googleapis.com/kubernetes-release/release/$(<span style="font-weight: bold;">curl</span> -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
</pre>
</div>
<p>
To download a specific version, replace the $(curl -s <a href="https://storage.googleapis.com/kubernetes-release/release/stable.txt">https://storage.googleapis.com/kubernetes-release/release/stable.txt</a>) portion of the command with the specific version.
</p>
<p>
For example, to download version v1.15.0 on Linux, type:
</p>
<div class="org-src-container">
<pre class="src src-sh">curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/amd64/kubectl
</pre>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-org19ac5e9">
<h3 id="org19ac5e9">Install using native package management</h3>
<div class="outline-text-3" id="text-org19ac5e9">
</div>
<div class="outline-4" id="outline-container-orgfdbebcf">
<h4 id="orgfdbebcf">Ubuntu/Debain</h4>
<div class="outline-text-4" id="text-orgfdbebcf">
<div class="org-src-container">
<pre class="src src-sh">sudo apt-get update &amp;&amp; sudo apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
<span style="font-weight: bold;">echo</span> <span style="font-style: italic;">"deb https://apt.kubernetes.io/ kubernetes-xenial main"</span> | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
</pre>
</div>
</div>
</div>
<div class="outline-4" id="outline-container-orgb1bc823">
<h4 id="orgb1bc823">CentOS, RHEL, Fedora</h4>
<div class="outline-text-4" id="text-orgb1bc823">
<div class="org-src-container">
<pre class="src src-sh">cat &lt;&lt;EOF &gt; /etc/yum.repos.d/kubernetes.repo
<span style="font-weight: bold;">[kubernetes]</span>
<span style="font-weight: bold;">name=Kubernetes</span>
<span style="font-weight: bold;">baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64</span>
<span style="font-weight: bold;">enabled=1</span>
<span style="font-weight: bold;">gpgcheck=1</span>
<span style="font-weight: bold;">repo_gpgcheck=1</span>
<span style="font-weight: bold;">gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg</span>
<span style="font-weight: bold;">EOF</span>
yum install -y kubectl
</pre>
</div>
</div>
</div>
<div class="outline-4" id="outline-container-orgd05c30d">
<h4 id="orgd05c30d">Install with snap</h4>
<div class="outline-text-4" id="text-orgd05c30d">
<div class="org-src-container">
<pre class="src src-sh">sudo snap install kubectl --classic
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="status" id="postamble">
<p class="date">Date: 2019-7-9</p>
<p class="author">Author: gdme1320</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
